/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package rukopisyimport.foxml;

import rukopisyimport.sourceData.ManuscriptIdentifier;

/**
 *
 * @author Martin Řehánek (rehan at mzk.cz)
 */
public class ImageIdentifier {

    private final String base;
    private final String sysno;
    private final String barcode;
    private final String urlSuffix;
    private String id;
    private String label;

    public static ImageIdentifier instanceOf(ManuscriptIdentifier mnsId, Page page) {
        String base = mnsId.getBase();
        String sysno = mnsId.getSysno();
        String barcode = mnsId.getBarcode();
        //int index = page.getPageIndex();
        String id = page.getId();
        String label = page.getLabel();
        String urlSuffix = page.getUrlSuffix();
        return new ImageIdentifier(base, sysno, barcode, id, label, urlSuffix);
        //String url = imageUrlBuilder.buildImgFullUrl(base, sysno, barcode, index);
    }

    private ImageIdentifier(String base, String sysno, String barcode, String id, String label, String urlSuffix) {
        this.base = base;
        this.sysno = sysno;
        this.barcode = barcode;
        this.id = id;
        this.label = label;
        this.urlSuffix = urlSuffix;
    }

    /**
     * This is only used in project RukopisyTools. Some of the functionality should be moved
     * to another project or RukopisyImport and RukopisyTools should be merged
     * @param base
     * @param sysno
     * @param barcode
     * @param urlSuffix
     */
    public ImageIdentifier(String base, String sysno, String barcode, String urlSuffix) {
        this.base = base;
        this.sysno = sysno;
        this.barcode = barcode;
        this.urlSuffix = urlSuffix;
    }

    /**
     * @return the base
     */
    public String getBase() {
        return base;
    }

    /**
     * @return the sysno
     */
    public String getSysno() {
        return sysno;
    }

    /**
     * @return the barcode
     */
    public String getBarcode() {
        return barcode;
    }

    public String getPageId() {
        return id;
    }

    public String getPageLabel() {
        return label;
    }

    public String getPageUrlSuffix() {
        return urlSuffix;
    }
}
